<?php
use yii\widgets\LinkPager;
use yii\helpers\Url;
use yii\bootstrap\ActiveForm;
use yii\helpers\Html;
use yii\helpers\Json;
use backend\assets\AppAsset;
use yii\web\View;
?>
<style>
    .content{ border: 1px solid #eee; width: 100%; padding: 10px;margin-bottom: 20px;margin-top: 10px;}
    .child{ border: 1px solid #eee; width: 50%; padding: 10px;margin-bottom: 20px; height: 40px; margin-top: 10px;}
    .child .child_body{width: 100px; float: left; margin-right: 20px}
</style>
<div class="ibox-title">
	<h5>添加管理员</h5>
</div>
<div class="ibox-content timeline">
    <div class="auth-item-model-form">
        <?php $form = ActiveForm::begin(['action' => ['item/addadmin'], 'method' => 'post']); ?>
        <input name="Admin[uid]" type="hidden" value="<?= isset($model->uid)? $model->uid : ''; ?>" >
        <?= $form->field($model, 'username')->textInput(['maxlength' => true]) ?>
        <?= $form->field($model, 'useremail')->textInput(['maxlength' => true]) ?>
        <?= $form->field($model, 'password')->passwordInput() ?>
        <?= $form->field($model, 'repass')->passwordInput() ?>

        <b>角色分配</b>
        <div class="content">
            <?php foreach($role_info as $val){ ?>
                <input type="checkbox" <?php if(in_array($val['name'],$admin_role)){ echo 'checked = "checked"';} ?> name="role[]<?= $val['name']?>" value="<?= $val['name']?>"> <?= $val['name'] ?>
            <?php } ?>           
        </div>

        <div class="form-group">
            <?= Html::submitButton('保存', ['class' =>  'btn btn-primary green']) ?>
        </div>
        <?php ActiveForm::end(); ?>
    </div>
</div>